import axios from "/@/utils/http/axios";
import {MethodEnum} from "/@/utils/http/axios/enum/method-enum";
import {MenuModel, MenuQueryModel} from "/@/api/system/model/MenuModel";
import {PageModel} from "/@/api/system/model/CommonModel";

/**
 * 获取当前登录菜单
 */
export function listMenuTreeByLoginUser( isHint: boolean,callBack?: Function):Promise<MenuModel[]> {
    return axios.httpRequest("/system/menu/listMenuTreeByLoginUser", MethodEnum.GET, {}, {callBack,isHint});
}


/**
 * 查询所有菜单权限列表树
 * @param isHint
 * @param callBack
 */
export function listMenuAuthTree(callBack?: Function):Promise<MenuModel[]> {
    return axios.httpRequest("/system/menu/listMenuAuthTree", MethodEnum.GET, {}, {callBack});
}


/**
 * 新增菜单
 * @param callBack
 */
export function insertMenu(data: MenuModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/system/menu/insertMenu", MethodEnum.POST, data, {callBack});
}

/**
 * 修改菜单
 * @param callBack
 */
export function updateMenu(data: MenuModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/system/menu/updateMenu", MethodEnum.POST, data, {callBack});
}

/**
 * 根据菜单id删除菜单
 * @param data
 * @param callBack
 */
export function deleteMenuByMenuId(menuId: string,callBack?: Function):Promise<void> {
    return axios.httpRequest("/system/menu/deleteMenuByMenuId", MethodEnum.GET, {menuId}, {callBack});
}

/**
 * 根据菜单id查询菜单
 * @param menuId
 * @param callBack
 */
export function selectMenuByMenuId(menuId: string,callBack?: Function):Promise<MenuModel> {
    return axios.httpRequest("/system/menu/selectMenuByMenuId", MethodEnum.GET, {menuId}, {callBack});
}
